#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

class Solution {
public:
    int distributeCandies(vector<int>& candyType)
    {
        int n = candyType.size();
        int eat = n / 2;
        int count = 0;
        sort(candyType.begin(), candyType.end());
        vector<int>::iterator it = unique(candyType.begin(), candyType.end());
        candyType.resize(distance(candyType.begin(), it));
        return candyType.size() > eat ? eat : candyType.size();
    }
};